package com.flying.scorer.score.equity.quarterlyreport;

import com.flying.refdata.model.equity.EquityInfo;
import com.flying.refdata.model.equity.QuarterlyReport;
import com.flying.refdata.service.ReportService;
import com.flying.scorer.score.ScoreException;

public class RevenueGrowthRateEquityScorer extends AbstractQuarterlyReportScorer {
    public RevenueGrowthRateEquityScorer(ReportService reportService) {
        super(reportService);
    }

    @Override
    public double score(int date, EquityInfo info) throws ScoreException {
        QuarterlyReport qr = getQuarterlyReport(info, date);
        double rate = qr.getRevenueGrowthRate();
        if (rate < 0) return 0;
        else if (rate < 5) return 2;
        else if (rate < 10) return 4;
        else if (rate < 15) return 6;
        else if (rate < 20) return 8;
        else return 10;
    }
}
